package com.Demo;

////文本框
//import javax.swing.*;
//import java.awt.*;
//
//public class TextDemo extends JFrame {
//    public TextDemo() {
//        Container container = this.getContentPane();
//
//        JTextField textField1 = new JTextField("hello"); //文本框初始值
//        JTextField textField2 = new JTextField("world",20); //文本框初始大小为20个字符
//
//        container.setLayout(new FlowLayout());
//        container.add(textField1);
//        container.add(textField2);
//
////        container.add(textField1,BorderLayout.NORTH);
////        container.add(textField2,BorderLayout.SOUTH);
//
//        this.setVisible(true);
//        this.setBounds(400,400,300,400);
//        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
//    }
//
//    public static void main(String[] args) {
//        new TextDemo();
//    }
//}


//密码框
import javax.swing.*;
import java.awt.*;

public class TextDemo extends JFrame {
    public TextDemo() {
        Container container = this.getContentPane();


        //一般配合面板使用，放入面板中
        JPasswordField passwordField = new JPasswordField();
        passwordField.setEchoChar('*');

        container.add(passwordField);

        this.setVisible(true);
        this.setBounds(400,400,300,400);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new TextDemo();
    }
}

